//过渡页面

import 'package:Smart/pages/productor007/studytest/flutter_boss/home.dart';
import 'package:flutter/material.dart';
//使用定时器需导入
import 'dart:async';

//import 'package:flutter_boss/index.dart';
//import 'home.dart';



class SplashPage extends StatefulWidget {
  @override
  SplashState createState() => new SplashState();
}

class SplashState extends State<SplashPage> {
  Timer _t;

  @override
  void initState() {
    super.initState();
    //事件处理    定时器  （参数1：延迟时间 参数2：结束后回调函数）  Duration() :持续时间
    _t = new Timer(const Duration(milliseconds: 1500), () {
      // 跳转并关闭当前页面
      try {
        Navigator.of(context).pushAndRemoveUntil(
            new MaterialPageRoute(
                builder: (BuildContext context) => IndexPage ()
            ),
            (Route route) => route == null
        );
      } catch (e) {}
    });
  }

  //组件销毁生命周期  组件即将销毁时调用
  @override
  void dispose() {
    //取消定时器
    _t.cancel();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Material(
      color: Color.fromARGB(255, 0, 215, 198),
      child: Padding(
          padding: const EdgeInsets.only(top: 150.0),
          child: Column(children: <Widget>[
            Text("用聊天的方式找工作",
                style: TextStyle(
                  fontSize: 30.0,
                  color: Colors.white,
                  fontWeight: FontWeight.bold,
                )),
            Padding(
              padding: const EdgeInsets.only(top: 500.0),
              child: Text("BOSS直聘",
                  style: TextStyle(
                    fontSize: 20.0,
                    color: Colors.white,
                    fontWeight: FontWeight.bold,
                  )),
            ),

            Padding(
                padding: const EdgeInsets.only(top: 5.0),
                child: Text("©2021 BOSS直聘 All rights reserved.",
                    style: TextStyle(
                      fontSize: 15.0,
                      color: Colors.white,
                      fontWeight: FontWeight.bold,
                    ))),
          ])),
    );
  }
}
